package edu.java.homework.hw09.exercises.salads.products;

public enum Vegetable {
    LETTUCE(2), CUCUMBER(2), TOMATO(10), CABBAGE(10), ONION(5), GARLIC(5), PARSLEY(
	    2), CARROT(5), CORNS(20), PEAS(10), PICKLED_CUCUMBER(20), BOILED_POTATO(
	    10), RAW_HOT_PEPPER(5), RAW_RED_PEPPER(5), BAKED_RED_PEPPER(5), RAW_GREEN_PEPPER(
	    5), TURNIP(10), MARINADE_MUSHROOMS(20), OLIVE(10);

    // --- Instance Variables --------------------------------------------------
    private int price = 0;

    // --- Constructors --------------------------------------------------------
    private Vegetable() {
	this(0);
    }

    private Vegetable(int price) {
	this.price = price;

	// WRONG PRACTICE --> NOT RECOMMEND to call other methods in the
	// constructors
	// setPrice(price);
    }

    // --- Methods -------------------------------------------------------------
    public int getPrice() {
	return price;
    }

    // Usually this is not good to be done, because the enum is supposed to keep
    // information, which is not going to be changed in the time
    /*public void setPrice(int price) {
	if (price < 0) {
	    throw new IllegalArgumentException(
		    "Incorrect input. The price would be 0 or positive integer number");
	}
	this.price = price;
    }*/

    @Override
    public String toString() {
	return this.name().toLowerCase();
    }

}
